package com.veetao.api;
import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.veetao.api.annotation.McpMethod;
import com.veetao.api.annotation.McpReq;
import com.veetao.api.model.ApiFacade;
import com.veetao.api.model.CommandContext;
import com.veetao.api.resp.CommonResultResp;
import com.veetao.api.resp.SingleDataResp;
import com.veetao.api.service.impl.SystemConfigService;

@Component
public class SystemConfigFacade implements ApiFacade{

    
	@Resource
	private SystemConfigService configService;
	

    @McpMethod(name = "admin.sysconfig.reload", ver = "1.0", desc = "重新加载系统配置信息", checkSig=false)
    public CommonResultResp reloadConfig(CommandContext context) {
    	
    	configService.reloadConfigs();
    	
    	
    	return CommonResultResp.SUCCESS;
    }
    
    @McpMethod(name = "admin.sysconfig.get", ver = "1.0", desc = "重新加载系统配置信息", checkSig=false)
    public SingleDataResp<String> getConfig(@McpReq(required=true,desc="配置项名称", name="name")String configName, CommandContext context) {
    	
    	String value = configService.getConfig(configName);
    	
    	return new SingleDataResp<String>(value);
    }

}
